let adivs = document.querySelectorAll('a[name^="div"]');
let anavs = document.querySelectorAll('.navbar a');

console.log(adivs, anavs);
let scrollToView = (page) => {
  anavs[index].classList.remove('active');
  index = page;
  anavs[page].classList.add('active');
  adivs[page].scrollIntoView({ behavior: 'smooth' });
};

let index = 0;

anavs.forEach((ele, i) => {
  ele.addEventListener('click', () => {
    scrollToView(i);
  });
});
window.huhuiyu = {
  scrollToView: scrollToView,
};
